﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchedulerExtension.Models
{
    /// <summary>
    /// 染色体
    /// </summary>
    public class Chromosome
    {
        public int[] FBarSelections { get; set; }

        public double Fitness { get; set; }
        public double TotalTime { get; set; }
        public  double TaktTimeDeviation { get; set; }

        public Dictionary<int, Dictionary<int,(double start, double end, int tank)>> Schedule { get; set; }
        public Chromosome Clone()
        {
            return new Chromosome
            {
                FBarSelections = (int[])FBarSelections.Clone(),
                Fitness = Fitness,
                TotalTime = TotalTime,
                TaktTimeDeviation = TaktTimeDeviation,
                Schedule = Schedule.ToDictionary(
                    kv => kv.Key,
                    kv => new Dictionary<int, (double, double, int)>(kv.Value))
            };
        }
    }
}
